package com.wen.springbootdistributionserver.controller;

import com.wen.springbootdistributionserver.service.DispatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dispatch")
public class DispatchController {

    @Autowired
    private DispatchService dispatchService;

    @GetMapping("/order")
    public String lock(String orderId)throws Exception{
        if("10001".equals(orderId)){
            Thread.sleep(3000);
        }
        dispatchService.dispatch(orderId);
        return "success";
    }

}
